<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>05-元素类样式</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: skyblue;
        }
        .change {
            background-color: yellow;
            color:#fff;
            font-size: 30px;
            margin-top: 100px;
        }
        h3{
            width: 100px;
            height: 100px;
            background-color: rgb(216, 113, 189);
        }
    </style>
</head>
<body>
    <div class="first">文本</div>
    <h3>积极向上</h3>
    <script>
        // 1. element.style 获得修改元素行内样式
        let div = document.querySelector('div');
        div.onclick = function(){
                // div.style.color = '#fff';
                // div.style.fontSize = '30px';
                // div.style.marginTop = '100px';
                // div.style.backgroundColor = 'purple';
            // 2. 通过类名修改样式
            div.className ='fist change';
        }
            let h3 = document.querySelector('h3');
            h3.onclick = function(){
            h3.className = 'h3 change';
        }
    </script>
    
</body>
</html>